/*
 * ImageItem.java
 * classes : com.ruint.lib.mediachooser.bean.ImageItem
 * @author ruint
 * V 1.0.0
 * Create at 2014-12-4 上午11:22:37
 */
package com.ruint.lib.mediachooser.bean;

import java.io.File;

import com.ruint.core.bean.BaseBean;

/**
 * com.ruint.lib.mediachooser.bean.ImageItem
 * 
 * @author ruint <br/>
 *         create at 2014-12-4 上午11:22:37
 */
public class ImageItem extends BaseBean {

  private static final long serialVersionUID = 1L;

  public ImageItem() {
    super();
  }

  public ImageItem(String imagePath, File file) {
    super();
    this.imagePath = imagePath;
    this.file = file;
  }

  private String imageId;
  private String thumbnailPath;
  private String imagePath;
  private String thumbpath;
  private String path;
  private File file;

  public File getFile() {
    if (file == null) {
      file = getImagePath() == null ? null : new File(imagePath);
    }
    return file;
  }

  /**
   * @return the path
   */
  public String getPath() {
    return path;
  }

  /**
   * @param path
   *          the path to set
   */
  public void setPath(String path) {
    this.path = path;
  }

  /**
   * @return the thumbpath
   */
  public String getThumbpath() {
    return thumbpath;
  }

  /**
   * @param thumbpath
   *          the thumbpath to set
   */
  public void setThumbpath(String thumbpath) {
    this.thumbpath = thumbpath;
  }

  private boolean isSelected = false;

  public String getImageId() {
    return imageId;
  }

  public void setImageId(String imageId) {
    this.imageId = imageId;
  }

  public String getThumbnailPath() {
    return thumbnailPath;
  }

  public void setThumbnailPath(String thumbnailPath) {
    this.thumbnailPath = thumbnailPath;
  }

  public String getImagePath() {
    return imagePath;
  }

  public void setImagePath(String imagePath) {
    this.imagePath = imagePath;
  }

  public boolean isSelected() {
    return isSelected;
  }

  public void setSelected(boolean isSelected) {
    this.isSelected = isSelected;
  }

  @Override
  public String toString() {
    return "ImageItem [imageId=" + imageId + ", thumbnailPath=" + thumbnailPath + ", imagePath=" + imagePath
        + ", isSelected=" + isSelected + "]";
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((imagePath == null) ? 0 : imagePath.hashCode());
    return result;
  }

  @Override
  public boolean equals(Object o) {
    if (null == o)
      return false;
    if (!(o instanceof ImageItem))
      return false;
    if (this == o || imagePath.equals(((ImageItem) o).getImagePath()))
      return true;
    else
      return false;
  }
}
